home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat1
/
xargs.z
/
xargs
Wrap
Text File
|
1998-10-20
|
11KB
|
199 lines
XXXXAAAARRRRGGGGSSSS((((1111)))) XXXXAAAARRRRGGGGSSSS((((1111))))
NNNNAAAAMMMMEEEE
xargs - construct argument list(s) and execute command
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
xxxxaaaarrrrggggssss [options] [ command [initial-arguments] ]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_xxxx_aaaa_rrrr_gggg_ssss constructs a command line consisting of the _c_o_m_m_a_n_d and _i_n_i_t_i_a_l-
_a_r_g_u_m_e_n_t_s operands specified followed by as many arguments read in
sequence from standard input as will fit in length and number constraints
specified by the options. _xxxx_aaaa_rrrr_gggg_ssss then invokes the constructed command
line and waits for its completion. This sequence is repeated until an
end-of-file condition is detected on standard input or an invocation of a
constructed command line returns an exit status of 255.
_c_o_m_m_a_n_d, which may be a shell file, is searched for, using one's $$$$PPPPAAAATTTTHHHH.
If _c_o_m_m_a_n_d is omitted, ////bbbbiiiinnnn////eeeecccchhhhoooo is used.
Arguments read in from standard input are defined to be contiguous
strings of characters delimited by one or more blanks, tabs, or new-
lines; empty lines are always discarded. Blanks and tabs may be embedded
as part of an argument if escaped or quoted. Characters enclosed in
quotes (single or double) are taken literally, and the delimiting quotes
are removed. Outside of quoted strings a backslash (\\\\) will escape the
next character.
The generated command line length will be the sum of the size in bytes of
the command name and each argument treated as strings, including a null
byte terminator for each of these strings. The _xxxx_aaaa_rrrr_gggg_ssss command will limit
the command line length such that when the command line is invoked, the
combined argument and environment lists will not exceed ARG_MAX-2048
bytes. Within this constraint, if neither the _----_nnnn nor the _----_ssss option is
specified, the default command line length will be at least LINE_MAX.
OOOOPPPPTTTTIIIIOOOONNNNSSSS
----LLLL_n_u_m_b_e_r _c_o_m_m_a_n_d is executed for each non-empty _n_u_m_b_e_r lines of
arguments from standard input. The last invocation of _c_o_m_m_a_n_d
will be with fewer lines of arguments if fewer than _n_u_m_b_e_r
remain. A line is considered to end with the first new-line
unless the last character of the line is a blank or a tab; a
trailing blank/tab signals continuation through the next non-
empty line.
_----_llll[_n_u_m_b_e_r]
Same as -L, except: if _n_u_m_b_e_r is omitted, 1 is assumed; option
----xxxx is forced.
----IIII_r_e_p_l_s_t_r Insert mode: _c_o_m_m_a_n_d is executed for each line from standard
input, taking the entire line as a single arg, inserting it in
_i_n_i_t_i_a_l-_a_r_g_u_m_e_n_t_s for each occurrence of _r_e_p_l_s_t_r. A maximum of
5 arguments in _i_n_i_t_i_a_l-_a_r_g_u_m_e_n_t_s may each contain one or more
instances of _r_e_p_l_s_t_r. Blanks and tabs at the beginning of each
PPPPaaaaggggeeee 1111
XXXXAAAARRRRGGGGSSSS((((1111)))) XXXXAAAARRRRGGGGSSSS((((1111))))
line are ignored. Constructed arguments may not grow larger
than what the kernel _n_c_a_r_g_s value allows (the default as
shipped is 20480), including room for pointers. This may be
further reduced, depending on environment size and other
arguments), and option ----xxxx is forced.
_----_iiii[_r_e_p_l_s_t_r]
Same as _----_IIII except that {{{{}}}} is assumed for _r_e_p_l_s_t_r if omitted.
The _----_IIII and _----_iiii options are mutually exclusive; the last one
specified takes effect.
----nnnn_n_u_m_b_e_r Execute _c_o_m_m_a_n_d using as many standard input arguments as
possible, up to _n_u_m_b_e_r arguments maximum. Fewer arguments will
be used if their total size is greater than _s_i_z_e characters,
and for the last invocation if there are fewer than _n_u_m_b_e_r
arguments remaining. In any case, a maximum of 1024 arguments
will be passed per command invocation. This is further reduced
by any extra command arguments given on the xargs command line.
If option ----xxxx is also coded, each _n_u_m_b_e_r arguments must fit in
the _s_i_z_e limitation, else _x_a_r_g_s terminates execution. The _----_LLLL,
_----_llll and _----_nnnn options are mutually exclusive; the last one
specified takes effect.
----tttt Trace mode: The _c_o_m_m_a_n_d and each constructed argument list are
echoed to file descriptor 2 just prior to their execution.
----pppp Prompt mode: The user is asked whether to execute _c_o_m_m_a_n_d each
invocation. Trace mode (----tttt) is turned on to print the command
instance to be executed, followed by a ????............ prompt. A reply of
yyyy (optionally followed by anything) will execute the command;
anything else, including just a carriage return, skips that
particular invocation of _c_o_m_m_a_n_d.
----xxxx Causes xxxxaaaarrrrggggssss to terminate if any argument list would be greater
than _s_i_z_e characters; ----xxxx is forced by the options ----iiii and ----llll.
When neither of the options ----iiii, ----llll, or ----nnnn are coded, the total
length of all arguments must be within the _s_i_z_e limit.
----ssss_s_i_z_e Invoke command using as many standard input arguments as
possible yielding a command line length less than _s_i_z_e (a
positive decimal integer) bytes. Fewer arguments will be used
if the total number of arguments (lines) exceeds that specified
by the _----_nnnn (_----_LLLL) option or end of file is encoutered on standard
input before _s_i_z_e bytes are accumulated. The maximum _s_i_z_e
depends partly on the size of the environment, but is limited
to a maximum of the kernel value of _n_c_a_r_g_s (the default as
shipped is 20480), including room for pointers. If ----ssss is not
coded, the maximum is taken as the default.
_----_EEEE_e_o_f_s_t_r Specify a logical end-of-file string to replace the default
underscore. xxxxaaaarrrrggggssss reads standard input until either end-of-file
or the logical EEEEOOOOFFFF string is encountered.
PPPPaaaaggggeeee 2222
XXXXAAAARRRRGGGGSSSS((((1111)))) XXXXAAAARRRRGGGGSSSS((((1111))))
_----_eeee[_e_o_f_s_t_r]
Same as _----_EEEE except that the option ----eeee with no _e_o_f_s_t_r coded turns
off the logical EEEEOOOOFFFF string capability (underbar is taken
literally).
Note: The _----_eeee, _----_iiii and _----_llll take optional option-arguments that cannot be
separate arguments.
xxxxaaaarrrrggggssss will terminate if either it receives a return code of ----1111 from, or
if it cannot execute, _c_o_m_m_a_n_d. When _c_o_m_m_a_n_d is a shell program, it
should explicitly _e_x_i_t (see _s_h(1)) with an appropriate value to avoid
accidentally returning with ----1111.
EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
The following will move all files from directory $1 to directory $2, and
echo each move command just before doing it:
ls $1 | xargs -i -t mv $1/{} $2/{}
or
ls $1 | xargs -I /{} -t mv $1/{} $2/{}
The following will combine the output of the parenthesized commands onto
one line, which is then echoed to the end of file _l_o_g:
(logname; date; echo $0 $*) | xargs >>log
The user is asked which files in the current directory are to be archived
and archives them into _a_r_c_h (1.) one at a time, or (2.) many at a time.
1. ls | xargs -p -l ar r arch
2. ls | xargs -p -l | xargs ar r arch
The following will execute _d_i_f_f(1) with successive pairs of arguments
originally typed as shell arguments:
echo $* | xargs -n2 diff
DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
_xxxx_aaaa_rrrr_gggg_ssss exits with 0 when all invocations of command returned exit status
zero. _xxxx_aaaa_rrrr_gggg_ssss exits with 126 when the command specified was found but
could not be invoked. _xxxx_aaaa_rrrr_gggg_ssss exits with 127 when the command specified
could not be found.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
sh(1).
PPPPaaaaggggeeee 3333